<?php
header("Content-type: application/json");

require_once("components/config.inc.php");
require_once("model/Player.php");
require_once("bizlayer/player_mgmt.php");



if(isset($_POST["playerid"]) && intval($_POST["playerid"])){
	$p = new Player();
	$p = PlayerMgmt::getPlayerById($_POST["playerid"]);
	$p->firstName = (isset($_POST["firstName"]))?$_POST["firstName"]:$p->firstName;
	$p->MI = (isset($_POST["MI"]))?$_POST["MI"]:$p->MI;
	$p->lastName = (isset($_POST["lastName"]))?$_POST["lastName"]:$p->lastName;
	$p->emailAddress = (isset($_POST["emailAddress"]))?$_POST["emailAddress"]:$p->emailAddress;
	$p->dob = (isset($_POST["dob"]))?$_POST["dob"]:$p->dob;
	$p->bio = (isset($_POST["bio"]))?$_POST["bio"]:$p->bio;
	$p->currentCity = (isset($_POST["currentCity"]))?$_POST["currentCity"]:$p->currentCity;
	$p->homeTown = (isset($_POST["homeTown"]))?$_POST["homeTown"]:$p->homeTown; 
	$p->verified = (isset($_POST["verified"]))?$_POST["verified"]:$p->verified;
	$p->locked = (isset($_POST["locked"]))?$_POST["locked"]:$p->locked; 
	$p->admin = (isset($_POST["admin"]))?$_POST["admin"]:$p->admin;
	PlayerMgmt::updatePlayer($p);
	
	echo $p->toJson();		
}

?>
